<script setup>
  import {ref} from "vue";

  const n1=ref('')
  const n2=ref('')
  let n3=parseInt(Math.random()*100)+1
  console.log(n3)
  const btn=()=>{

    if(n1.value==n3){
      n2.value='猜对了'
    }else if(n1.value<n3){
      n2.value='猜小了'
    }else{
      n2.value='猜大了'
    }
  }
</script>

<template>
  <h1>猜数字练习</h1>
  <input type="text" v-model="n1">
  <button @click="btn">猜一猜</button>
  <h4>{{n2}}</h4>
</template>

<style scoped>

</style>